<template>
	<el-container>
		<el-header class='x-header'>
			<b class="title">{{ page_info.title }}</b>
			<el-button v-if="$route.query.callback_url" size="mini" icon="el-icon-back" @click="g_page.funcBack">
				返回
			</el-button>
			<el-button size="mini" type="warning" icon="el-icon-edit-outline" @click="funcHandle">处理</el-button>
			<el-button size="mini" icon="el-icon-refresh" @click="g_page.funcReload()">刷新</el-button>
		</el-header>
		<el-main class='x-main'>
			<el-form :inline="true" :model="form_q" size="mini">
				<el-form-item label="姓名">
					<el-input v-model="form_q.compUserName" placeholder="姓名"></el-input>
				</el-form-item>
				<el-form-item label="手机">
					<el-input v-model="form_q.compUserPhone" placeholder="手机号码"></el-input>
				</el-form-item>
				<el-form-item label="状态">
					<el-select filterable v-model="form_q.compHandle" placeholder="请选择">
						<el-option label="全部" key="all" value="all"></el-option>
						<el-option v-for="(item,index) in page_info.handle"
								   :label="item"
								   :key="index"
								   :value="index">
						</el-option>
					</el-select>
				</el-form-item>
				<el-form-item>
					<el-button type="primary" @click="g_page.funcSearch">搜索</el-button>
				</el-form-item>
			</el-form>
			<div class="table-wrap">
				<el-table stripe ref="multipleTable" tooltip-effect="dark"
						  @selection-change="g_page.funcTableSelectionChange"
						  :data="list_data">
					<el-table-column type="selection"></el-table-column>
					<el-table-column label="订单号">
						<template slot-scope="data">
							<div v-html="data.row.cscb_order_id"></div>
						</template>
					</el-table-column>
					<el-table-column label="客户">
						<template slot-scope="data">
							<div v-html="data.row.cuser_name"></div>
							<div v-html="data.row.cuser_phone"></div>
							<div v-html="data.row.celog_openid"></div>
						</template>
					</el-table-column>
					<el-table-column label="报销日期">
						<template slot-scope="data">
							<div v-html="data.row.cscb_date"></div>
						</template>
					</el-table-column>
					<el-table-column label="金额">
						<template slot-scope="data">
							<div v-html="data.row.cscb_price"></div>
						</template>
					</el-table-column>
					<el-table-column label="凭证图片">
						<template slot-scope="data">
							<CompImg :img_root="page_info.static_file_root" :img_val="data.row.cscb_pic"></CompImg>
						</template>
					</el-table-column>
					<el-table-column label="创建时间">
						<template slot-scope="data">
							{{ data.row.cscb_create_date }}
						</template>
					</el-table-column>
					<el-table-column label="状态">
						<template slot-scope="data">
							<div style="font-size: 12px;">
								<div>{{ data.row.handle }}</div>
								<div v-if="data.row.cscb_handle!=0">
									<div>{{data.row.cscb_handle_date}}</div>
									<div style="color:blue;">处理人：{{ data.row.acc_name }}</div>
								</div>
							</div>
						</template>
					</el-table-column>
					<el-table-column label="处理原因">
						<template slot-scope="data">
							{{ data.row.cscb_handle_desc }}
						</template>
					</el-table-column>
				</el-table>
			</div>
		</el-main>
		<!---->
		<!---->
		<!-- 分页 -->
		<el-footer v-if="page_show" class="x-page">
			<el-pagination class="paging" background layout="total, sizes, prev, pager, next, jumper"
						   @current-change="g_page.funcPageChange" :page-sizes="[page_size]"
						   :current-page="page_index" :page-size="page_size" :total="page_total">
			</el-pagination>
		</el-footer>
		<!---->
		<!---->
		<!-- 弹框 -->
		<el-dialog title="停车费处理" :visible.sync="form_dialog_visible" width="70%">
			<el-form ref="form" :rules="form_rules" :model="form" size="mini" label-width="15%">
				<el-form-item label="原因">
					<el-input v-model="form.desc" placeholder="选填"/>
					<div class="x-alert">
						<span>注意：已处理记录，无法再更改</span>
					</div>
				</el-form-item>
			</el-form>
			<div slot="footer" class="dialog-footer">
				<el-button @click="funcHandleApi(10)" size="mini">不通过</el-button>
				<el-button type="success" @click="funcHandleApi(1)" size="mini">通过</el-button>
			</div>
		</el-dialog>
		<!---->
		<!---->
		<!---->
	</el-container>
</template>


<script>
	import {
		Message,
		MessageBox,
		Loading
	} from 'element-ui'

	export default {
		data() {
			let page_data = { super_uid: '' }
			//
			page_data = this.g_cc.funcGetInitData(page_data)
			//
			return page_data
		},
		mounted() {
			console.log('mounted')
			//
			this.g_page.funcSetVue(this)
			// 应用ID
			this.g_page.funcSetApiUrlList('/xadmin/app_car/app_car__stop_callback__list')
			// this.g_page.funcSetApiUrlDel('/xadmin/app_car/app_car__ensure__list/del')
			//页码
			this.g_page.funcSetPageSize(20)
			//搜索
			this.form_q = {
				'compKw': ''
			}
			this.g_page.funcGetList()
			//
			this.form_rules = {
				acc_uidX: [
					{
						required: true,
						message: '必填',
						trigger: 'blur'
					}
				]
			}
			//
		},
		methods: {
			////////////////////
			//审核
			funcHandle() {
				let ids = this.g_page.funcGetIds()
				if (ids == '') {
					this.g_cc.func_alert('至少选择一项', 'info')
					return
				}
				this.form_dialog_visible = true
			},
			funcHandleApi(apply) {
				let ids = this.g_page.funcGetIds()
				this.g_cc.func_axios({
					url: '/xadmin/app_car/app_car__stop_callback__list/handle',
					data: {
						ids: ids,
						handle: apply,
						desc: this.form.desc
					},
					success: (res) => {
						//
						this.form_dialog_visible = false
						if (res.data.errcode == 0) {
							this.g_cc.func_alert('成功', 'success', () => {
								this.g_page.funcGetList()
							})
						} else {
							this.g_cc.func_alert(res.data.errmsg)
						}
					}
				})
			}
			////////////////////
		}
	}
</script>

